package com.etc.yzrnx.library.utils;


import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

import sun.misc.BASE64Encoder;

public class ServiceUtils {

	// encode password
	public static String md5(String message){
		try {
			MessageDigest md=MessageDigest.getInstance("md5");
			
			byte[] md5= md.digest(message.getBytes());
			
			BASE64Encoder encoder=new BASE64Encoder();
			return encoder.encode(md5);
			
			
		} catch (NoSuchAlgorithmException e) {
			e.printStackTrace();
		}
		return null;
	}
	
	public static void main(String[] args) {
		System.out.println(ServiceUtils.md5("123"));
	}
}
